<template>
  <div id="Detail">
    <v-details :detailData="data.detailData"
               :inputConfig="inputConfig"
               :rules="rules"
               ref="input"></v-details>
  </div>
</template>

<script>

import details from 'commons/Detail'
import baseMixin from "@/mixins/BaseMixin";

export default {
  name: "AsnDetails",
  mixins: [baseMixin],
  props: {
    data: {
      type: Object
    }
  },
  data () {
    return {
      whseidflag: false,
      flag: false,
      rules: {
        code: [
          { required: true, message: this.$inputEmptyMes("common.code"), trigger: 'blur' },
        ],
        description: [
          { required: true, message: this.$inputEmptyMes("common.desc"), trigger: 'blur' },
        ],

      },
    }
  },
  computed: {
    inputConfig () {
      return [
        [
          {
            type: "input",
            label: this.$t('common.code'),
            props: "code",
            disabled: this.flag
          },
          {
            type: "input",
            label: this.$t('common.desc'),
            props: "description",
            disabled: this.whseidflag
          },
          {
            type: "input",
            label: this.$t('config.sequence'),
            props: "sequence",
            disabled: this.whseidflag
          },
          {
            type: "textarea",
            label: this.$t('common.note'),
            props: "notes",
            disabled: this.whseidflag
          },
          {
            type: "checkbox",
            label: this.$t('config.activityStatus'),
            props: "active",
            disabled: this.whseidflag
          },
        ],
        [
          {
            type: "input",
            label: this.$t('config.activityStatus') + "1",
            props: "udf1",
            disabled: this.whseidflag
          },
          {
            type: "input",
            label: this.$t('config.activityStatus') + "2",
            props: "udf2",
            disabled: this.whseidflag
          },
          {
            type: "input",
            label: this.$t('config.activityStatus') + "3",
            props: "udf3",
            disabled: this.whseidflag
          },
          {
            type: "input",
            label: this.$t('config.activityStatus') + "4",
            props: "udf4",
            disabled: this.whseidflag
          },
          {
            type: "input",
            label: this.$t('config.activityStatus') + "5",
            props: "udf5",
            disabled: this.whseidflag
          },
        ]
      ]
    },
  },
  methods: {},
  mounted () {
    if (this.$store.state.newFlag || this.$parent.detailNew) {
      this.flag = false;
    } else {
      this.flag = true;
    }
  },
  watch: {},
  components: {
    'v-details': details
  }
}
</script>

<style scoped>
</style>
